#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：图灵学习 
@File    ：1.作业-豆瓣电影评论.py
@IDE     ：PyCharm 
@Author  ：ChenLiGao
@Date    ：2024-11-22 10:37
'''
import requests
from lxml import etree

url = "https://movie.douban.com/subject/1292052/comments?status=P"

headers = {
    "user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
}

response = requests.get(url, headers=headers)

html = etree.HTML(response.text)

results = html.xpath("//span[@class='short']/text()")

for result in results:
    print(result)
    print("------"*20)